/*    */ package cc.s2m.web.s2mBlog.controller.admin;
/*    */ 
/*    */ import cc.s2m.util.BeanConverter;
/*    */ import cc.s2m.util.Page;
/*    */ import cc.s2m.web.s2mBlog.controller.base.BaseController;
/*    */ import cc.s2m.web.s2mBlog.pojo.AdminActions;
/*    */ import cc.s2m.web.s2mBlog.service.IAdminActions;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.ui.Model;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.bind.annotation.ResponseBody;
/*    */ 
/*    */ @Controller("admin_AdminActionsController")
/*    */ @RequestMapping({"/admin/adminActions"})
/*    */ public class AdminActionsController extends BaseController
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private IAdminActions adminActionsService;
/*    */ 
/*    */   @RequestMapping({"/list"})
/*    */   public String list(Model model, AdminActions bean, Integer page)
/*    */   {
/* 28 */     if (page == null) page = Integer.valueOf(1);
/* 29 */     Map map = new HashMap();
/* 30 */     if (bean != null) {
/* 31 */       map.putAll(BeanConverter.toMap(bean, false));
/* 32 */       model.addAttribute("bean", bean);
/*    */     }
/* 34 */     map.put("orderBy", "paixu ASC");
/* 35 */     Page pageBean = this.adminActionsService.getPage(page.intValue(), 2147483647, null, map);
/* 36 */     model.addAttribute("pageBean", pageBean);
/* 37 */     return "admin/adminActions";
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"/add"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public String add(Model model, Integer id) {
/* 42 */     if (id != null) {
/* 43 */       AdminActions bean = (AdminActions)this.adminActionsService.selectByPrimaryKey(id);
/* 44 */       model.addAttribute("bean", bean);
/*    */     }
/* 46 */     Map map = new HashMap();
/* 47 */     map.put("orderBy", "paixu ASC");
/* 48 */     List list = this.adminActionsService.getList(new AdminActions(), map);
/* 49 */     model.addAttribute("list", list);
/* 50 */     return "admin/adminActions_add";
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"/view"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public String view(Model model, Integer id) {
/* 55 */     if (id != null) {
/* 56 */       AdminActions bean = (AdminActions)this.adminActionsService.selectByPrimaryKey(id);
/* 57 */       model.addAttribute("bean", bean);
/*    */     }
/* 59 */     return "admin/adminActions_view";
/*    */   }
/*    */   @RequestMapping(value={"/save"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   @ResponseBody
/*    */   public String save(Model model, AdminActions bean) {
/* 65 */     if (bean == null) {
/* 66 */       return "empty";
/*    */     }
/* 68 */     if (bean.getPid() != null) {
/* 69 */       AdminActions parent = (AdminActions)this.adminActionsService.selectByPrimaryKey(bean.getPid());
/* 70 */       if (parent != null) {
/* 71 */         bean.setLevel(Integer.valueOf(parent.getLevel().intValue() + 1));
/*    */       }
/*    */     }
/* 74 */     if (bean.getId() == null)
/*    */     {
/* 76 */       this.adminActionsService.insertSelective(bean);
/*    */     }
/*    */     else {
/* 79 */       this.adminActionsService.updateByPrimaryKeySelective(bean);
/*    */     }
/* 81 */     return "success";
/*    */   }
/*    */   @RequestMapping(value={"/del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   @ResponseBody
/*    */   public String del(Integer id) {
/* 87 */     AdminActions bean = (AdminActions)this.adminActionsService.selectByPrimaryKey(id);
/* 88 */     if (bean != null) {
/* 89 */       this.adminActionsService.deleteByPrimaryKey(id);
/*    */     }
/* 91 */     return "success";
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\s2mBlog.zip
 * Qualified Name:     s2mBlog-3.0.0.WEB-INF.classes.cc.s2m.web.s2mBlog.controller.admin.AdminActionsController
 * JD-Core Version:    0.6.1
 */